package com.barbarosso.video {
	import com.barbarosso.video.controller.PlayVideoCommand;
	import com.barbarosso.video.controller.StartupCommand;
	
	import org.puremvc.as3.multicore.patterns.facade.Facade;		

	/**
	 * @author barbarosso
	 */
	public class ApplicationFacade extends Facade {
		
		public static const STARTUP 		: String = "com.barbarosso.video.startup";
		public static const PLAY_VIDEO 		: String = "com.barbarosso.video.playVideo";
		
		public function ApplicationFacade(key : String) {
			super(key);
		}
		
		public static function getInstance( key:String ) : ApplicationFacade 
        {
            if ( instanceMap[ key ] == null ) instanceMap[ key ] = new ApplicationFacade( key );
            return instanceMap[ key ] as ApplicationFacade;

        }
    
        public function startup( app : VideoPlayer ) : void {
			sendNotification( STARTUP, app );
        }
            
        override protected function initializeController () : void
        {
            super.initializeController();
            registerCommand( STARTUP, StartupCommand);    
            registerCommand( PLAY_VIDEO, PlayVideoCommand);    
        }
	}
}
